class Timer:
	
	def __init__(self, quantum, aKernel):
		self.timer = quantum
		self.quantum = quantum
		self.kernel = aKernel
		self.kernel.cpu.addObserver(self)
		
	def notify(self):
		if self.quantum > 1:
			self.quantum-= 1
		else:
			self.restart()
			self.kernel.interrupt.interrupt('timeOut')
			
	def restart(self):
		self.quantum = self.timer